package com.softeem.ssm1.service.impl;

import com.softeem.ssm1.dao.StudentMapper;
import com.softeem.ssm1.entity.Student;
import com.softeem.ssm1.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author 11091
 * @Date 2019/10/12 10:35
 */
@Transactional
@Service
public class StudentServiceImpl implements IStudentService {

    @Autowired
    private StudentMapper studentMapper;

//    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public boolean add(Student stu) {
        return studentMapper.insert(stu)>0;
    }

    @Override
    public List<Student> queryAll() {
        return studentMapper.selectAll();
    }

    @Override
    public Student queryById(Integer id) {
        return studentMapper.selectById(id);
    }
}
